package com.example.study.demo

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester.Companion.createRefs
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.ConstraintSet
import com.bianque.studyhavecompose.R
 
import com.example.study.jetpack.compose.Compose的State

/**
 *  created by ws
 *   on 2022/3/3
 *   describe:
 */
class 原神抽卡ViewDemo {

    @Preview
    @Composable
    fun Home(){
        val tabList = remember{ mutableStateListOf<Int>(R.mipmap.xaingyu)}
        BoxWithConstraints {
            val constrains = decoupledConstraints(16.dp)
            ConstraintLayout(constrains) {
                LazyColumn{
                    items(10){index ->
                        Column {
                            Compose的State().counter1()
                            /*Text(text = "$index")
                            Image(painter = painterResource(id = tabList[0]),
                                contentDescription = "图片",
                                Modifier.size(54.dp)
                            )    */
                        }
                        

                    }
                }

            }
            
        }
    }
    private fun decoupledConstraints(margin: Dp): ConstraintSet {
        return ConstraintSet {
            val button = createRefFor("button")
            val text = createRefFor("text")

            constrain(button) {
                top.linkTo(parent.top, margin = margin)
            }
            constrain(text) {
                top.linkTo(button.bottom, margin)
            }
        }
    }
}